package pers.lx.crm.controller.business;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import pers.lx.crm.base.common.pigeon.Result;
import pers.lx.crm.entiy.business.BusinessDO;
import pers.lx.crm.entiy.business.BusinessListDO;
import pers.lx.crm.entiy.business.FlowDO;
import pers.lx.crm.service.business.FlowService;

/**
 * Created by lx on 2017/4/26.
 */
@Controller
@RequestMapping(value = "flow")
public class FlowController {

    @Autowired
    private FlowService flowService ;

    @RequestMapping(value = "/list")
    public @ResponseBody
    Result getTagList(FlowDO flowDO){
        return flowService.getFlows(flowDO) ;
    }

    @RequestMapping(value = "/add",method = RequestMethod.POST)
    public @ResponseBody
    Result addTag(@RequestBody FlowDO flowDO){
        Result result = flowService.addFlow(flowDO) ;
        return result ;
    } ;

    @RequestMapping(value = "/update",method = RequestMethod.POST)
    public @ResponseBody
    Result updateTag(@RequestBody FlowDO flowDO){
        Result result = flowService.updateFlow(flowDO) ;
        return  result ;
    }

    @RequestMapping(value = "/remove",method = RequestMethod.POST)
    public @ResponseBody
    Result removeTags(@RequestBody BusinessListDO listDO){
        Result result = flowService.removeFlows(listDO.getFlowDOs()) ;
        return  result ;
    }

}
